IO
Section: Miscellaneous Library Functions (3X)
Updated: April 11, 1991
Index
Return to Main Contents
NAME
io - tile kernel unix standard io interface
SYNOPSIS
io
DESCRIPTION
The
tile
forth kernel support word set for the standard unix system calls
and library for io.
- vocabulary io ( -- )
-
The Unix standard library io functions. The io vocabulary is an
non-standard extension of Forth-83 and not directly portable to
other forth environments.
- code open ( filename flags mode -- des)
-
Opens a named file for reading and/or writing, as specified by the
flags argument. The parameter is used when a new file is created to
define the access mode of the file. Return a file descriptor or error.
- code close ( des -- int)
-
Closes the file associated with the descriptor. Returns the value 0
is successful else the value -1 is returned to indicate an error.
- code read ( des buf nbytes -- int)
-
Attempts to read nbytes of data from the file references by the
descriptor into the buffer pointed to by buf. Returns the number
of bytes actually read. If EOF the return is 0.
- code write ( des buf nbytes -- int)
-
Attempts to write nbytes of data from the buffer pointer to by buf to
the file referenced by the descriptor. Returns the number of bytes
actually written otherwise the return value -1 to indicate an error.
- code lseek ( des offset whence -- int)
-
Positions the file referenced by the descriptor to the position given
by the offset and the position mode whence. The modes are absolute (0),
relative (1), and relative end of file (2). Returns the new position on
the file in bytes else the value -1 to indicate an error.
- code fdopen ( des type -- stream)
-
Associates a stream with the file descriptor des.
- code fopen ( filename type -- stream)
-
Opens the file named by filename and associates a stream with it.
If the open is successful the word return a pointer to the the
stream else NIL is returned. The type parameter is a string
with one of the following values: "r" for read, "w" for write,
"a" for append, "r+" for update, "w+" for truncate or create
for update, and "a+" open or create for update for EOF.
- code fclose ( stream -- int)
-
Writes out any buffered data and closes the stream. Internal buffers
are freed. Returns 0 if successful else the value EOF is returned.
- code fgetc ( stream -- int)
-
Reads a character for the stream. Returns EOF at EOF or at an error.
- code fgets ( stream buf nbytes -- buf)
-
Reads a sequence of characters from the stream into the buffer buf
until EOF or NEWLINE or nbytes-1 have been received. The input string is
null terminated.
- code fputc ( stream char -- int)
-
Writes a character to the stream. Returns the character written.
- code fputs ( stream buf -- int)
-
Writes the null terminated string to the stream. Returns EOF on error.
- code ungetc ( stream char -- int)
-
-
-
ftell ( stream -- int)
- fseek ( stream offset -- int)
-
- fflush ( stream -- int)
-
SEE ALSO
tile(1),
forth(3X).
NOTE
The function list is sorted in logical order.
The type and mode of the entries are indicated together with
their parameter stack effect.
COPYING
Copyright (C) 1991 Mikael R.K. Patel
Permission is granted to make and distribute verbatim copies
of this manual provided the copyright notice and this permission
notice are preserved on all copies.
Permission is granted to copy and distribute modified versions
of this manual under the conditions for verbatim copying,
provided also that the section entitled "GNU General Public
License" is included exactly as in the original, and provided
that the entire resulting derived work is distributed under
the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of
this manual into another language, under the above conditions
for modified versions, except that the section entitled "GNU
General Public License" may be included in a translation approved
by the author instead of in the original English.
AUTHOR
Mikael R.K. Patel
Computer Aided Design Laboratory (CADLAB)
Department of Computer and Information Science
Linkoping University
S-581 83 LINKOPING
SWEDEN
HB TILE Technology
c/o Palmervik-Patel
Stragatan 19
S-582 67 LINKOPING
SWEDEN
Email: mip@ida.liu.se
ikael R.K. Patel!
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- SEE ALSO
-
- NOTE
-
- COPYING
-
- AUTHOR
-
This document was created by
man2html,
using the manual pages.
Time: 09:30:40 GMT, February 02, 2023